package us.sunrisemorning.douyuplaypokemon;

import us.sunrisemorning.bilibili_live_chat.BiliBiliLiveChatMessageHandler;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

public class MessageHandler implements BiliBiliLiveChatMessageHandler {

    private final List<String> orders = new ArrayList<String>();
    private final RobotControl control;

    public MessageHandler() throws AWTException {
        orders.add("up");
        orders.add("down");
        orders.add("left");
        orders.add("right");
        orders.add("a");
        orders.add("b");
        orders.add("select");
        orders.add("start");

        control = new RobotControl();
        control.start();
    }

    public void handleMessage(String message, String senderName, int senderId) {
        String txt = message.toLowerCase();
        if (orders.contains(txt)) {
            control.push(txt);
        }
    }
}
